using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ExitSpeedButton : MonoBehaviour
{
    // Start is called before the first frame update
    private float exitTime = 0.5f;
    private float speed = 2.0f;
    private bool isSpeedUp = false;
    public void OnExitButtonPressed()
    {
        Debug.Log("Exit Pressed");
        Time.timeScale = 1;
        LevelManager.instance.GameEnd();
        GameManager.instance.LoadMainMenu();
    }

    public void OnSpeedButtonPressed()
    {
        isSpeedUp = !isSpeedUp;
        Debug.Log("Speed Pressed");
        if (isSpeedUp)
        {
            foreach(var sp in GetComponentsInChildren<Image>())
            {   
                sp.color = Color.blue;
            }
            Time.timeScale = speed;
        }
        else
        {
            foreach(var sp in GetComponentsInChildren<Image>())
            {   
                sp.color = Color.white;
            }
            Time.timeScale = 1;
        }
    }
}
